package com.example.mytest.DAO;

import com.example.mytest.Entity.DeviceEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by Studio on 2017/5/18.
 */
@Repository
public interface DeviceDAO extends JpaRepository<DeviceEntity,Integer> {
    @Query(value = "update device set online = 0 where id=? AND online = 1",nativeQuery = true)
    @Modifying
    @Transactional
    public int updateOnline(String id);
}
